/*
 * @file permission_widget
 * @Author: liuer
 * @Date: 2024/8/5 09:43
 * @LastModified: 2024-08-05 09:43
 * @LastModifiedBy: liuer
 */
import 'package:flutter/cupertino.dart';
import 'package:yt_devops/utils/enums.dart';
import 'package:yt_devops/utils/func_utils.dart';

class PermissionWidget extends StatelessWidget{
  final List? permissionStringList;///传进来的权限名字列表,例如
  final Widget child;///展示的子组件
  final AuthorityModeType mode;///权限模式,默认是包含模式
  const PermissionWidget({super.key,
    required this.permissionStringList,
    required this.child,
    this.mode = AuthorityModeType.within
  });

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Visibility(
      visible: FuncUtils.isPassAuthority(permissionStringList,mode: mode),
        child: Container(
      child: child,
    ));
  }
}